//
//  MeatMeServiceTableViewCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/3.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "MeatMeServiceTableViewCell.h"
#import "MeatMeItem.h"


@implementation MeatMeServiceTableViewCell

#pragma mark - lifecycle methods

- (void)setupUI
{
    [self addSubview:self.collectionItem];
    [self addSubview:self.vouchersItem];
    [self addSubview:self.assetsItem];
    [self addSubview:self.adoptItem];
    [self addSubview:self.cartItem];
    [self addSubview:self.locationItem];
    [self addSubview:self.questionItem];
    [self addSubview:self.helpItem];
    [self addSubview:self.meatshopItem];

    
}

- (void)setupLayout
{
    {
        _collectionItem.mj_x = 0;
        _vouchersItem.mj_x = _collectionItem.right;
        _assetsItem.mj_x = _vouchersItem.right;
        
    }
    
    float offset = 5;
    {
        _adoptItem.mj_x = 0;
        _cartItem.mj_x = _adoptItem.right;
        _locationItem.mj_x = _cartItem.right;
        
        _adoptItem.mj_y = _cartItem.mj_y = _locationItem.mj_y = _collectionItem.bottom - offset;
        
    }
    
    {
        _questionItem.mj_x = 0;
        _helpItem.mj_x = _questionItem.right;
        _meatshopItem.mj_x = _helpItem.right;

        _questionItem.mj_y = _helpItem.mj_y = _meatshopItem.mj_y = _adoptItem.bottom - offset;

    }
    
}


#pragma mark - setter methods


#pragma mark - getter methods

- (MeatMeItem *)collectionItem{
    
    if (!_collectionItem) {
        _collectionItem = [[MeatMeItem alloc] init];
        _collectionItem.icon.image = [UIImage imageNamed:@"user_service_collect"];
        _collectionItem.nameLab.text = @"我的收藏";
        _collectionItem.type = MeatMeItemType_Service;
        _collectionItem.oweLab.hidden = YES;
        
        @weakify(self);
        _collectionItem.isNeedAnimation = YES;
        _collectionItem.tapBlock = ^{
            @strongify(self);
            if (self.dealCollectionBlock) {
                self.dealCollectionBlock();
            }
        };
    }
    return _collectionItem;
}

- (MeatMeItem *)vouchersItem{
    
    if (!_vouchersItem) {
        _vouchersItem = [[MeatMeItem alloc] init];
        _vouchersItem.icon.image = [UIImage imageNamed:@"user_service_coupon"];
        _vouchersItem.nameLab.text = @"豚券";
        _vouchersItem.type = MeatMeItemType_Service;
        _vouchersItem.oweLab.hidden = YES;
        
        @weakify(self);
        _vouchersItem.isNeedAnimation = YES;
        _vouchersItem.tapBlock = ^{
            @strongify(self);
            if (self.dealVouchersBlock) {
                self.dealVouchersBlock();
            }
        };
    }
    return _vouchersItem;
}


- (MeatMeItem *)assetsItem{
    
    if (!_assetsItem) {
        _assetsItem = [[MeatMeItem alloc] init];
        _assetsItem.icon.image = [UIImage imageNamed:@"user_service_asset"];
        _assetsItem.nameLab.text = @"我的资产";
        _assetsItem.type = MeatMeItemType_Service;
        _assetsItem.oweLab.hidden = NO;

        @weakify(self);
        _assetsItem.isNeedAnimation = YES;
        _assetsItem.tapBlock = ^{
            @strongify(self);
            if (self.dealAssetsBlock) {
                self.dealAssetsBlock();
            }
        };
        
    }
    return _assetsItem;
}


- (MeatMeItem *)adoptItem{
    
    if (!_adoptItem) {
        _adoptItem = [[MeatMeItem alloc] init];
        _adoptItem.icon.image = [UIImage imageNamed:@"user_service_myadopted"];
        _adoptItem.nameLab.text = @"我的领养";
        _adoptItem.type = MeatMeItemType_Service;
        _adoptItem.oweLab.hidden = YES;
        
        @weakify(self);
        _adoptItem.isNeedAnimation = YES;
        _adoptItem.tapBlock = ^{
            @strongify(self);
            if (self.dealAdoptBlock) {
                self.dealAdoptBlock();
            }
        };
    }
    return _adoptItem;
}


 - (MeatMeItem *)cartItem{
 
 if (!_cartItem) {
     
     _cartItem = [[MeatMeItem alloc] init];
     _cartItem.icon.image = [UIImage imageNamed:@"user_service_shoppingcart"];
     _cartItem.nameLab.text = @"购物车";
     _cartItem.type = MeatMeItemType_Service;
     _cartItem.oweLab.hidden = YES;
     
     @weakify(self);
     _cartItem.isNeedAnimation = YES;
     _cartItem.tapBlock = ^{
         @strongify(self);
         if (self.dealCartBlock) {
             self.dealCartBlock();
         }
     };
    }
     return _cartItem;
 }


 - (MeatMeItem *)locationItem{
 
 if (!_locationItem) {

     _locationItem = [[MeatMeItem alloc] init];
     _locationItem.icon.image = [UIImage imageNamed:@"user_service_address"];
     _locationItem.nameLab.text = @"收货地址";
     _locationItem.type = MeatMeItemType_Service;
     _locationItem.oweLab.hidden = YES;
     
     @weakify(self);
     _locationItem.isNeedAnimation = YES;
     _locationItem.tapBlock = ^{
         @strongify(self);
         if (self.dealLocationBlock) {
             self.dealLocationBlock();
         }
     };

    }
 return _locationItem;
 }
 
 
 - (MeatMeItem *)questionItem{
 
 if (!_questionItem) {
     
     _questionItem = [[MeatMeItem alloc] init];
     _questionItem.icon.image = [UIImage imageNamed:@"user_service_query"];
     _questionItem.nameLab.text = @"常见问题";
     _questionItem.type = MeatMeItemType_Service;
     _questionItem.oweLab.hidden = YES;
     
     @weakify(self);
     _questionItem.isNeedAnimation = YES;
     _questionItem.tapBlock = ^{
         @strongify(self);
         if (self.dealQuestionBlock) {
             self.dealQuestionBlock();
         }
     };

    }
 return _questionItem;
     
 }
 
 
 - (MeatMeItem *)helpItem{
 
 if (!_helpItem) {
     
     _helpItem = [[MeatMeItem alloc] init];
     _helpItem.icon.image = [UIImage imageNamed:@"user_service_help"];
     _helpItem.nameLab.text = @"帮助";
     _helpItem.type = MeatMeItemType_Service;
     _helpItem.oweLab.hidden = YES;
     
     @weakify(self);
     _helpItem.isNeedAnimation = YES;
     _helpItem.tapBlock = ^{
         @strongify(self);
         if (self.dealHelpBlock) {
             self.dealHelpBlock();
         }
     };

    }
  return _helpItem;
 }
 
- (MeatMeItem *)meatshopItem{
    
    if (!_meatshopItem) {
        _meatshopItem = [[MeatMeItem alloc] init];
        _meatshopItem.icon.image = [UIImage imageNamed:@"user_service_vendorenter"];
        _meatshopItem.nameLab.text = @"我的肉铺";
        _meatshopItem.type = MeatMeItemType_Service;
        _meatshopItem.oweLab.hidden = YES;

        @weakify(self);
        _meatshopItem.isNeedAnimation = YES;
        _meatshopItem.tapBlock = ^{
            @strongify(self);
            if (self.dealMeatShopBlock) {
                self.dealMeatShopBlock();
            }
        };
    }
    return _meatshopItem;
}





@end
